﻿using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Yoozoo.Gta.Common;

/// <summary>
/// PlayerName
/// </summary>
public static partial class GpuHudEntityHelper
{
    /// <summary>
    /// 加载PlayerNameEntity
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    public static GpuPlayerNameEntity LoadPlayerNameById(int id)
    {
        return GetHudEntity<GpuPlayerNameEntity>(GpuHudEntityType.PlayerName, id,1);
    }

    /// <summary>
    /// 显示PlayerNameHud
    /// </summary>
    /// <param name="id"></param>
    /// <param name="initPos"></param>
    /// <param name="color"></param>
    /// <param name="nickName"></param>
    /// <returns></returns>
    public static GpuPlayerNameEntity ShowPlayerNameHud(int id, Vector3 initPos, Color color,float scale, string nickName)
    {
        GpuPlayerNameEntity playerNameEntity = GpuHudFacade.GpuFacade.GetPlayerNameEntity(id);
        playerNameEntity.SetOriginPosition(initPos);
        playerNameEntity.SetName(nickName,new PlayerNameAlterContext(){
          refreshColor = false
        },
        false);

        //生命周期开始
        playerNameEntity.OnPlay();
        playerNameEntity.SetColor(color);
        playerNameEntity.SetScale(scale);
        if (nickName == "")
        {
            playerNameEntity.SetVisible(false);
        }

        return playerNameEntity;
    }
}
